/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ProjectForm.java
 *
 * Created on 18-may-2012, 18:33:29
 */
package pe.edu.pucp.TrabajoGrupal.gui;

import java.awt.Dimension;
import javax.swing.*;
import pe.edu.pucp.TrabajoGrupal.Classes.*;
import java.sql.*;

/**
 *
 * @author Ronald
 */
public class ProjectForm extends javax.swing.JFrame {
    User us = null;

    ClassDAO cddao = new ClassDAO();
    /** Creates new form ProjectForm */
    public ProjectForm() {
        
        
        initComponents();
        //initCustomComponentsProy();
        LoginDialog loginDialog = new LoginDialog(ProjectForm.this,true);
        loginDialog.setVisible(true);
        if (loginDialog.isLoginResponse()){
            us = loginDialog.getUserData();
            
            this.userNameText.setText(us.getUser());
            this.rolUserLabel.setText(us.getRole());
            this.userFullNameText.setText(us.getName());
            this.userMailText.setText(us.getEmail());
            this.stateUserLabel.setText(us.getState());
        }
        User newuser=null;
        Session ses = Session.getInstance();
        try{
        newuser = ses.getUserData();        
        }
        catch(Exception e){           
        }
        cddao.UpdateTable(this.listUserTable,"select u.usuarioid, u.usuario, u.nombre, u.email, r.nombreRol from usuario u , roles r where u.idRol = r.idRol"); 
        cddao.UpdateTable(this.listTaskTable,"select t.tareaid, t.tareanombre, p.proyecto, t.descripcion, t.horastrabajo from tarea t, proyecto p where t.proyectoid = p.proyectoid");
        //cddao.UpdateTable(this.listAdvanceTable,"select p.proyectoid, p.proyecto, p.inicio, p.fin from usuario_proyecto u, proyecto p where p.proyectoid = u.proyectoid and u.usuarioid=" + newuser.getUserId() + ")");
        cddao.UpdateTable(this.listAdvancesTable, "select * from proyecto where proyectoid in (select proyectoid from usuario_proyecto where usuarioid =" + newuser.getUserId() + ")");
        cddao.UpdateTable(this.listProjectTable, "select * from proyecto");
        //this.setBounds(350, 200, 550, 400);
        this.UpdateComboboxProject();
        String rolUser = newuser.getRole();
        if (rolUser.compareTo("ADMIN") != 0){
            this.projectPane.removeAll();
            this.taskPane.removeAll();
        }
        
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton5 = new javax.swing.JButton();
        projectTabbedPane = new javax.swing.JTabbedPane();
        userIdPanel = new javax.swing.JTabbedPane();
        myProfileJPanel = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        userNameText = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        stateUserLabel = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        userFullNameText = new javax.swing.JTextField();
        userMailText = new javax.swing.JTextField();
        saveChangesUserProfileButton = new javax.swing.JButton();
        rolUserLabel = new javax.swing.JLabel();
        changePasswordPanel = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        OkNewPassword = new javax.swing.JButton();
        oldPasswordField = new javax.swing.JPasswordField();
        newPasswordField = new javax.swing.JPasswordField();
        newPasswordVerifyField = new javax.swing.JPasswordField();
        newUserPanel = new javax.swing.JPanel();
        jLabel25 = new javax.swing.JLabel();
        userEmailText = new javax.swing.JTextField();
        idUserText = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        nameUserText = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        userPasswordText = new javax.swing.JPasswordField();
        saveUserButton = new javax.swing.JButton();
        UserRoleText = new javax.swing.JComboBox();
        jLabel33 = new javax.swing.JLabel();
        manageUserPanel = new javax.swing.JPanel();
        listUserScrollPanel = new javax.swing.JScrollPane();
        listUserTable = new javax.swing.JTable();
        manageUserIdField = new javax.swing.JTextField();
        manageUserField = new javax.swing.JTextField();
        manageEmailField = new javax.swing.JTextField();
        manageNameField = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        manageRolCombobox = new javax.swing.JComboBox();
        manageSaveButton = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jTabbedPane5 = new javax.swing.JTabbedPane();
        jPanel11 = new javax.swing.JPanel();
        jLabel17 = new javax.swing.JLabel();
        ProjectComboBox = new javax.swing.JComboBox();
        jLabel18 = new javax.swing.JLabel();
        TaskComboBox = new javax.swing.JComboBox();
        jLabel19 = new javax.swing.JLabel();
        AdvanceTimeField = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        saveAdvanceButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        AdvanceField = new javax.swing.JTextArea();
        manageAdavancePanel = new javax.swing.JPanel();
        ListAdvanceScrollPane = new javax.swing.JScrollPane();
        listAdvancesTable = new javax.swing.JTable();
        jButton2 = new javax.swing.JButton();
        projectPane = new javax.swing.JPanel();
        requiredNameLabel = new javax.swing.JLabel();
        requiredStartDateLabel = new javax.swing.JLabel();
        requiredFinishDateLabel = new javax.swing.JLabel();
        requiredTotalHoursLabel = new javax.swing.JLabel();
        newProjectTabbedPane = new javax.swing.JTabbedPane();
        newProjectPane = new javax.swing.JPanel();
        saveButton = new javax.swing.JButton();
        totalHorasText = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        finishDateText = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        startDateText = new javax.swing.JTextField();
        nameProjectText = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        manageProjectPane = new javax.swing.JPanel();
        projectsScrollPanel = new javax.swing.JScrollPane();
        listProjectTable = new javax.swing.JTable();
        NameProjectText = new javax.swing.JTextField();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        beginDateProjectText = new javax.swing.JTextField();
        endDateProjectText = new javax.swing.JTextField();
        jLabel34 = new javax.swing.JLabel();
        userListComboBox = new javax.swing.JComboBox();
        userProjectButton = new javax.swing.JButton();
        taskPane = new javax.swing.JPanel();
        jTabbedPane3 = new javax.swing.JTabbedPane();
        saveTaskButton = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        ProjectsComboBox = new javax.swing.JComboBox();
        TaskNameField = new javax.swing.JTextField();
        TaskDescField = new javax.swing.JTextField();
        TaskHoursField = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        AdvanceScrollPane = new javax.swing.JScrollPane();
        listTaskTable = new javax.swing.JTable();

        jButton5.setText("Cancelar");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBounds(new java.awt.Rectangle(0, 0, 30, 30));
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel2.setText("Nombre de Usuario:");

        userNameText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                userNameTextActionPerformed(evt);
            }
        });

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel4.setText("Rol:");

        stateUserLabel.setText("Estado de Usuario");

        jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel7.setText("Nombre:");

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel8.setText("Email:");

        jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel10.setText("Estado:");

        userFullNameText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                userFullNameTextActionPerformed(evt);
            }
        });

        userMailText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                userMailTextActionPerformed(evt);
            }
        });

        saveChangesUserProfileButton.setText("Guardar Cambios");
        saveChangesUserProfileButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveChangesUserProfileButtonActionPerformed(evt);
            }
        });

        rolUserLabel.setText("Rol de Usuario");

        javax.swing.GroupLayout myProfileJPanelLayout = new javax.swing.GroupLayout(myProfileJPanel);
        myProfileJPanel.setLayout(myProfileJPanelLayout);
        myProfileJPanelLayout.setHorizontalGroup(
            myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(myProfileJPanelLayout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addGroup(myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(saveChangesUserProfileButton)
                    .addGroup(myProfileJPanelLayout.createSequentialGroup()
                        .addGroup(myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel4)
                            .addComponent(jLabel7))
                        .addGap(33, 33, 33)
                        .addGroup(myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(rolUserLabel)
                            .addComponent(userNameText, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE)
                            .addComponent(userFullNameText)))
                    .addGroup(myProfileJPanelLayout.createSequentialGroup()
                        .addGroup(myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel10))
                        .addGap(111, 111, 111)
                        .addGroup(myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(userMailText, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(stateUserLabel))))
                .addContainerGap(82, Short.MAX_VALUE))
        );
        myProfileJPanelLayout.setVerticalGroup(
            myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(myProfileJPanelLayout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addGroup(myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(userNameText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(rolUserLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel7)
                    .addComponent(userFullNameText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(userMailText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(myProfileJPanelLayout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addComponent(saveChangesUserProfileButton))
                    .addGroup(myProfileJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(stateUserLabel)
                        .addComponent(jLabel10)))
                .addContainerGap(172, Short.MAX_VALUE))
        );

        userIdPanel.addTab("Mi Perfil", myProfileJPanel);

        jLabel6.setText("Ingrese la clave antigua");

        jLabel11.setText("Ingrese la clave nueva");

        jLabel12.setText("Vuelva a Ingresar la nueva clave");

        OkNewPassword.setText("Aceptar");
        OkNewPassword.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                OkNewPasswordActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout changePasswordPanelLayout = new javax.swing.GroupLayout(changePasswordPanel);
        changePasswordPanel.setLayout(changePasswordPanelLayout);
        changePasswordPanelLayout.setHorizontalGroup(
            changePasswordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(changePasswordPanelLayout.createSequentialGroup()
                .addGap(70, 70, 70)
                .addGroup(changePasswordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(OkNewPassword)
                    .addGroup(changePasswordPanelLayout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addGap(18, 18, 18)
                        .addComponent(newPasswordVerifyField, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE))
                    .addGroup(changePasswordPanelLayout.createSequentialGroup()
                        .addGroup(changePasswordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6)
                            .addComponent(jLabel11))
                        .addGap(61, 61, 61)
                        .addGroup(changePasswordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(oldPasswordField, javax.swing.GroupLayout.DEFAULT_SIZE, 140, Short.MAX_VALUE)
                            .addComponent(newPasswordField))))
                .addContainerGap(65, Short.MAX_VALUE))
        );
        changePasswordPanelLayout.setVerticalGroup(
            changePasswordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(changePasswordPanelLayout.createSequentialGroup()
                .addGap(70, 70, 70)
                .addGroup(changePasswordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(oldPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(changePasswordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(newPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(changePasswordPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(changePasswordPanelLayout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addGap(18, 18, 18)
                        .addComponent(OkNewPassword))
                    .addComponent(newPasswordVerifyField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(188, Short.MAX_VALUE))
        );

        userIdPanel.addTab("Cambiar Clave", changePasswordPanel);

        jLabel25.setText("Nombre");

        idUserText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                idUserTextActionPerformed(evt);
            }
        });

        jLabel26.setText("Email");

        jLabel27.setText("ID Usuario");

        jLabel28.setText("Password");

        saveUserButton.setText("Guardar");
        saveUserButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveUserButtonActionPerformed(evt);
            }
        });

        UserRoleText.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ADMIN", "USER" }));
        UserRoleText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                UserRoleTextActionPerformed(evt);
            }
        });

        jLabel33.setText("Rol");

        javax.swing.GroupLayout newUserPanelLayout = new javax.swing.GroupLayout(newUserPanel);
        newUserPanel.setLayout(newUserPanelLayout);
        newUserPanelLayout.setHorizontalGroup(
            newUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(newUserPanelLayout.createSequentialGroup()
                .addGroup(newUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(newUserPanelLayout.createSequentialGroup()
                        .addGap(46, 46, 46)
                        .addGroup(newUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel28)
                            .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel26)
                            .addComponent(jLabel33))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(newUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(userEmailText, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(newUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(nameUserText)
                                .addComponent(idUserText)
                                .addComponent(userPasswordText, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(UserRoleText, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(newUserPanelLayout.createSequentialGroup()
                        .addGap(166, 166, 166)
                        .addComponent(saveUserButton)))
                .addContainerGap(189, Short.MAX_VALUE))
        );
        newUserPanelLayout.setVerticalGroup(
            newUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(newUserPanelLayout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(newUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(idUserText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel27))
                .addGap(20, 20, 20)
                .addGroup(newUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(userPasswordText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel28))
                .addGap(18, 18, 18)
                .addGroup(newUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nameUserText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel25))
                .addGap(23, 23, 23)
                .addGroup(newUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(userEmailText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(newUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(UserRoleText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel33))
                .addGap(17, 17, 17)
                .addComponent(saveUserButton)
                .addContainerGap(109, Short.MAX_VALUE))
        );

        userIdPanel.addTab("Nuevo Usuario", newUserPanel);

        listUserTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        listUserTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                listUserTableMouseClicked(evt);
            }
        });
        listUserScrollPanel.setViewportView(listUserTable);

        manageUserIdField.setEnabled(false);
        manageUserIdField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                manageUserIdFieldActionPerformed(evt);
            }
        });

        jLabel21.setText("User Id");

        jLabel22.setText("Usuario");

        jLabel23.setText("Email");

        jLabel24.setText("Nombre");

        jLabel29.setText("Rol");

        manageRolCombobox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ADMIN", "USER" }));

        manageSaveButton.setText("Guardar");
        manageSaveButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                manageSaveButtonMouseClicked(evt);
            }
        });
        manageSaveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                manageSaveButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout manageUserPanelLayout = new javax.swing.GroupLayout(manageUserPanel);
        manageUserPanel.setLayout(manageUserPanelLayout);
        manageUserPanelLayout.setHorizontalGroup(
            manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(manageUserPanelLayout.createSequentialGroup()
                .addGroup(manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(manageUserPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(listUserScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(manageUserPanelLayout.createSequentialGroup()
                        .addGap(39, 39, 39)
                        .addGroup(manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel22)
                            .addComponent(jLabel23, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel21, javax.swing.GroupLayout.Alignment.LEADING))
                        .addGap(18, 18, 18)
                        .addGroup(manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(manageUserIdField)
                            .addComponent(manageUserField, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
                            .addComponent(manageEmailField))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(manageUserPanelLayout.createSequentialGroup()
                                .addGroup(manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel24)
                                    .addComponent(jLabel29))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(manageRolCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(manageNameField, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(manageSaveButton))))
                .addContainerGap(27, Short.MAX_VALUE))
        );
        manageUserPanelLayout.setVerticalGroup(
            manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(manageUserPanelLayout.createSequentialGroup()
                .addComponent(listUserScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(29, 29, 29)
                .addGroup(manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(manageUserIdField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(manageNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21)
                    .addComponent(jLabel24))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(manageUserField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel22)
                    .addComponent(jLabel29)
                    .addComponent(manageRolCombobox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(manageUserPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(manageEmailField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel23))
                    .addComponent(manageSaveButton))
                .addGap(0, 5, Short.MAX_VALUE))
        );

        userIdPanel.addTab("Administrar Usuarios", manageUserPanel);

        projectTabbedPane.addTab("Usuarios", userIdPanel);

        jLabel17.setText("Proyecto");

        ProjectComboBox.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ProjectComboBoxItemStateChanged(evt);
            }
        });

        jLabel18.setText("Tarea");

        jLabel19.setText("Ingrese número de horas");

        jLabel20.setText("Observaciones");

        saveAdvanceButton.setText("Guardar");
        saveAdvanceButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveAdvanceButtonActionPerformed(evt);
            }
        });

        AdvanceField.setColumns(20);
        AdvanceField.setRows(5);
        jScrollPane1.setViewportView(AdvanceField);

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGap(78, 78, 78)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(saveAdvanceButton)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jLabel20, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel17, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel19, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel18, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(AdvanceTimeField)
                            .addComponent(ProjectComboBox, 0, 136, Short.MAX_VALUE)
                            .addComponent(TaskComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE))
                .addContainerGap(92, Short.MAX_VALUE))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addComponent(jLabel17))
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(ProjectComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(TaskComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(8, 8, 8)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(AdvanceTimeField, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)
                    .addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel20)
                .addGap(6, 6, 6)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(saveAdvanceButton)
                .addGap(37, 37, 37))
        );

        jTabbedPane5.addTab("Nuevo Avance", jPanel11);

        listAdvancesTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Proyecto ID", "Proyecto", "Inicio", "Fin"
            }
        ));
        ListAdvanceScrollPane.setViewportView(listAdvancesTable);

        jButton2.setText("Ver Avance");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout manageAdavancePanelLayout = new javax.swing.GroupLayout(manageAdavancePanel);
        manageAdavancePanel.setLayout(manageAdavancePanelLayout);
        manageAdavancePanelLayout.setHorizontalGroup(
            manageAdavancePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(manageAdavancePanelLayout.createSequentialGroup()
                .addGroup(manageAdavancePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(manageAdavancePanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(ListAdvanceScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 426, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(manageAdavancePanelLayout.createSequentialGroup()
                        .addGap(77, 77, 77)
                        .addComponent(jButton2)))
                .addContainerGap(59, Short.MAX_VALUE))
        );
        manageAdavancePanelLayout.setVerticalGroup(
            manageAdavancePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(manageAdavancePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ListAdvanceScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(31, 31, 31)
                .addComponent(jButton2)
                .addContainerGap(95, Short.MAX_VALUE))
        );

        jTabbedPane5.addTab("Mis Avances", manageAdavancePanel);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane5)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jTabbedPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 368, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 69, Short.MAX_VALUE))
        );

        projectTabbedPane.addTab("Avances", jPanel5);

        saveButton.setText("Guardar");
        saveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveButtonActionPerformed(evt);
            }
        });

        jLabel9.setText("Horas Totales");

        jLabel5.setText("FechaFin");

        jLabel3.setText("Fecha Inicio");

        nameProjectText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nameProjectTextActionPerformed(evt);
            }
        });

        jLabel1.setText("Nombre del Proyecto:");

        javax.swing.GroupLayout newProjectPaneLayout = new javax.swing.GroupLayout(newProjectPane);
        newProjectPane.setLayout(newProjectPaneLayout);
        newProjectPaneLayout.setHorizontalGroup(
            newProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(newProjectPaneLayout.createSequentialGroup()
                .addGap(45, 45, 45)
                .addGroup(newProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(newProjectPaneLayout.createSequentialGroup()
                        .addGroup(newProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel1)
                            .addComponent(jLabel9)
                            .addComponent(jLabel3))
                        .addGap(98, 98, 98)
                        .addGroup(newProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(startDateText, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(newProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(finishDateText, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(totalHorasText, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(nameProjectText, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(newProjectPaneLayout.createSequentialGroup()
                        .addGap(138, 138, 138)
                        .addComponent(saveButton)))
                .addContainerGap(42, Short.MAX_VALUE))
        );
        newProjectPaneLayout.setVerticalGroup(
            newProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(newProjectPaneLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(newProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(startDateText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(newProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(nameProjectText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(newProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(finishDateText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(newProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(totalHorasText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGap(18, 18, 18)
                .addComponent(saveButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(333, Short.MAX_VALUE))
        );

        newProjectTabbedPane.addTab("Nuevo Proyecto", newProjectPane);

        listProjectTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Id", "Proyecto", "Inicio", "Fin","Horas"
            }
        ));
        listProjectTable.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                listProjectTableMouseClicked(evt);
            }
        });
        projectsScrollPanel.setViewportView(listProjectTable);

        jLabel30.setText("Nombre del Proyecto");

        jLabel31.setText("Fecha Inicio");

        jLabel32.setText("Fecha Fin");

        jLabel34.setText("Usuarios");

        userProjectButton.setText("Vincular");
        userProjectButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                userProjectButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout manageProjectPaneLayout = new javax.swing.GroupLayout(manageProjectPane);
        manageProjectPane.setLayout(manageProjectPaneLayout);
        manageProjectPaneLayout.setHorizontalGroup(
            manageProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(manageProjectPaneLayout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addGroup(manageProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(projectsScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 395, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(manageProjectPaneLayout.createSequentialGroup()
                        .addGroup(manageProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel30)
                            .addComponent(jLabel31)
                            .addComponent(jLabel34))
                        .addGap(53, 53, 53)
                        .addGroup(manageProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(userListComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(NameProjectText)
                            .addComponent(endDateProjectText)
                            .addComponent(beginDateProjectText, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE)
                            .addComponent(userProjectButton))))
                .addContainerGap(36, Short.MAX_VALUE))
        );
        manageProjectPaneLayout.setVerticalGroup(
            manageProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(manageProjectPaneLayout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addComponent(projectsScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(48, 48, 48)
                .addGroup(manageProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(NameProjectText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel30))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(manageProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel31)
                    .addComponent(beginDateProjectText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(manageProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel32)
                    .addComponent(endDateProjectText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(manageProjectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel34)
                    .addComponent(userListComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(userProjectButton)
                .addContainerGap(140, Short.MAX_VALUE))
        );

        newProjectTabbedPane.addTab("Administrar Proyecto", manageProjectPane);

        javax.swing.GroupLayout projectPaneLayout = new javax.swing.GroupLayout(projectPane);
        projectPane.setLayout(projectPaneLayout);
        projectPaneLayout.setHorizontalGroup(
            projectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(projectPaneLayout.createSequentialGroup()
                .addComponent(newProjectTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 472, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(24, 24, 24)
                .addGroup(projectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(requiredStartDateLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(requiredNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(requiredTotalHoursLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(requiredFinishDateLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        projectPaneLayout.setVerticalGroup(
            projectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, projectPaneLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(projectPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(projectPaneLayout.createSequentialGroup()
                        .addComponent(requiredStartDateLabel)
                        .addGap(62, 62, 62))
                    .addGroup(projectPaneLayout.createSequentialGroup()
                        .addComponent(requiredNameLabel)
                        .addGap(330, 330, 330)))
                .addComponent(requiredFinishDateLabel)
                .addGap(47, 47, 47)
                .addComponent(requiredTotalHoursLabel)
                .addGap(447, 447, 447))
            .addGroup(projectPaneLayout.createSequentialGroup()
                .addComponent(newProjectTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        projectTabbedPane.addTab("Proyecto", projectPane);

        jLabel13.setText("Proyectos");

        jLabel14.setText("Nombre de la tarea");

        jLabel15.setText("Descripción");

        jLabel16.setText("Horas de Trabajo");

        jButton1.setText("Agregar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout saveTaskButtonLayout = new javax.swing.GroupLayout(saveTaskButton);
        saveTaskButton.setLayout(saveTaskButtonLayout);
        saveTaskButtonLayout.setHorizontalGroup(
            saveTaskButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(saveTaskButtonLayout.createSequentialGroup()
                .addGroup(saveTaskButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(saveTaskButtonLayout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addGroup(saveTaskButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(36, 36, 36)
                        .addGroup(saveTaskButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(TaskHoursField)
                            .addComponent(TaskDescField)
                            .addComponent(TaskNameField)
                            .addComponent(ProjectsComboBox, 0, 159, Short.MAX_VALUE)))
                    .addGroup(saveTaskButtonLayout.createSequentialGroup()
                        .addGap(176, 176, 176)
                        .addComponent(jButton1)))
                .addContainerGap(95, Short.MAX_VALUE))
        );
        saveTaskButtonLayout.setVerticalGroup(
            saveTaskButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(saveTaskButtonLayout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(saveTaskButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(ProjectsComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(saveTaskButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(TaskNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(saveTaskButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(TaskDescField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(saveTaskButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(TaskHoursField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addGap(37, 37, 37))
        );

        jTabbedPane3.addTab("Nueva Tarea", saveTaskButton);

        listTaskTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Tarea ID", "Nombre de Tarea", "Proyecto", "Descripción","Horas de Trabajo"
            }
        ));
        AdvanceScrollPane.setViewportView(listTaskTable);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(AdvanceScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 431, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(AdvanceScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane3.addTab("Administrar Tareas", jPanel7);

        javax.swing.GroupLayout taskPaneLayout = new javax.swing.GroupLayout(taskPane);
        taskPane.setLayout(taskPaneLayout);
        taskPaneLayout.setHorizontalGroup(
            taskPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(taskPaneLayout.createSequentialGroup()
                .addComponent(jTabbedPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 463, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 42, Short.MAX_VALUE))
        );
        taskPaneLayout.setVerticalGroup(
            taskPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(taskPaneLayout.createSequentialGroup()
                .addComponent(jTabbedPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 187, Short.MAX_VALUE))
        );

        jTabbedPane3.getAccessibleContext().setAccessibleName("Nueva Tarea");

        projectTabbedPane.addTab("Tareas", taskPane);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(32, 32, 32)
                .addComponent(projectTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 513, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(projectTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE, 474, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(20, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    private void UpdateComboboxProject(){
        try
        {
            this.ProjectComboBox.removeAllItems();
            this.ProjectsComboBox.removeAllItems();
            String url = "jdbc:mysql://localhost:3306/dbproyectos";
            String usr = "root";
            String password = "";
            //Class.forName("com.mysql.jdbc.Driver");
            //DriverManager.registerDriver(new org.gjt.mm.mysql.Driver());
            Connection con = DriverManager.getConnection (url,usr, password);            
			
			Statement stat = con.createStatement();
			ResultSet resultado = stat.executeQuery ("SELECT proyecto FROM proyecto"); 
			while (resultado.next())
			{
                            ProjectComboBox.addItem (resultado.getObject("proyecto"));
                            ProjectsComboBox.addItem (resultado.getObject("proyecto"));
                        }
			
			/*resultado = stat.executeQuery ("SELECT tareanombre FROM tarea where "); 
			while (resultado.next())
			{TaskComboBox.addItem (resultado.getObject("tareanombre"));}
*/
                        resultado = stat.executeQuery("SELECT usuario FROM usuario");
                        while (resultado.next())
                        {userListComboBox.addItem(resultado.getObject("usuario"));
                        }
			resultado.close();
			con.close();
                        
                        
        }



		catch (SQLException ex) {

        }
    }
    private void saveUserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveUserButtonActionPerformed
        // TODO add your handling code here:
        ClassDAO dao = new ClassDAO();
        User newuser = new User(this.idUserText.getText(), this.userPasswordText.getText(), this.userEmailText.getText(), this.UserRoleText.getSelectedItem().toString(), this.nameUserText.getText());
        dao.guardar(newuser);
        cddao.UpdateTable(this.listUserTable,"select u.usuarioid, u.usuario, u.nombre, u.email, r.nombreRol from usuario u , roles r where u.idRol = r.idRol"); 
    }//GEN-LAST:event_saveUserButtonActionPerformed

    private void idUserTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_idUserTextActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_idUserTextActionPerformed

    private void userNameTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userNameTextActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_userNameTextActionPerformed

    private void userFullNameTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userFullNameTextActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_userFullNameTextActionPerformed

    private void userMailTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userMailTextActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_userMailTextActionPerformed

    private void saveChangesUserProfileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveChangesUserProfileButtonActionPerformed
        // TODO add your handling code here:
        ClassDAO dao = new ClassDAO();
        User newuser = new User();
        newuser.setEmail(this.userMailText.getText());
        newuser.setUser(this.userNameText.getText());
        newuser.setRole(this.rolUserLabel.getText());
        newuser.setName(this.userFullNameText.getText());
        newuser.setState(this.stateUserLabel.getText());
        newuser.setUserId(us.getUserId());
        newuser.setPassword(us.getPassword());
        dao.Update(newuser);
    }//GEN-LAST:event_saveChangesUserProfileButtonActionPerformed

    private void OkNewPasswordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OkNewPasswordActionPerformed
        // TODO add your handling code here:
        ClassDAO dao = new ClassDAO();
        User newuser=null;
        Session ses = Session.getInstance();
        try{
        newuser = ses.getUserData();        
        }
        catch(Exception e){           
        }
        String OldPassword = ClassDAO.getMD5(this.oldPasswordField.getText());
        if (OldPassword.compareTo(newuser.getPassword())==0){
            String NewPassword = this.newPasswordField.getText();
            String NewPasswordVerify = this.newPasswordVerifyField.getText();
            if (NewPassword.compareTo(NewPasswordVerify)==0){
                newuser.setPassword(NewPassword);
                dao.UpdatePassword(newuser);
            }
            else{
            //Aca deberia poner que no se churrete con sus claves
            }
        }
        else{
        //Aca deberia poner q no se xurrete con su clave original
        }
        
    }//GEN-LAST:event_OkNewPasswordActionPerformed

    private void UserRoleTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_UserRoleTextActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_UserRoleTextActionPerformed


    private void listUserTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listUserTableMouseClicked
        // TODO add your handling code here:
        int row = this.listUserTable.getSelectedRow();
        this.manageUserIdField.setText(listUserTable.getModel().getValueAt(row,0).toString());
        this.manageUserField.setText(listUserTable.getModel().getValueAt(row,1).toString());
        this.manageNameField.setText(listUserTable.getModel().getValueAt(row,2).toString());
        this.manageEmailField.setText(listUserTable.getModel().getValueAt(row,3).toString());
        int index = 0;
        if (listUserTable.getModel().getValueAt(row,4).toString().compareTo("ADMIN") == 0) index = 0;
        else index = 1;
        this.manageRolCombobox.setSelectedIndex(index);
        
    }//GEN-LAST:event_listUserTableMouseClicked

    private void manageSaveButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_manageSaveButtonMouseClicked
        User us = new User();
        us.setUserId(Integer.parseInt(this.manageUserIdField.getText()));
        us.setUser(this.manageUserField.getText());
        us.setName(this.manageNameField.getText());
        us.setEmail(this.manageEmailField.getText());
        us.setRole(this.manageRolCombobox.getSelectedItem().toString());
        cddao.updateUser(us);
        cddao.UpdateTable(this.listUserTable,"select u.usuarioid, u.usuario, u.nombre, u.email, r.nombreRol from usuario u , roles r where u.idRol = r.idRol"); 
    }//GEN-LAST:event_manageSaveButtonMouseClicked


    private void ProjectsComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ProjectsComboBoxActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_ProjectsComboBoxActionPerformed

    private void TaskButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TaskButtonActionPerformed
        // TODO add your handling code here:
        ClassDAO dao = new ClassDAO();
        dao.InsertTask(this.ProjectsComboBox.getSelectedItem().toString(), this.TaskNameField.getText(), this.TaskHoursField.getText(), this.TaskDescField.getText());
        //User newuser = new User(this.idUserText.getText(), this.userPasswordText.getText(), this.userEmailText.getText(), this.UserRoleText.getSelectedItem().toString(), this.nameUserText.getText());
    }//GEN-LAST:event_TaskButtonActionPerformed

    private void saveAdvanceButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAdvanceButtonActionPerformed
        
        ClassDAO dao = new ClassDAO();
        try{
        User user = Session.getInstance().getUserData();
            dao.InsertAdvance(this.ProjectComboBox.getSelectedItem().toString(),this.TaskComboBox.getSelectedItem().toString(), user.getUserId()+"" , this.AdvanceTimeField.getText(), this.AdvanceField.getText());
        }
        catch (Exception e){
            
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_saveAdvanceButtonActionPerformed

    private void nameProjectTextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nameProjectTextActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_nameProjectTextActionPerformed

    private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
        ClassDAO dao = new ClassDAO();
        Project project = new Project(this.startDateText.getText(), this.nameProjectText.getText(), this.finishDateText.getText(), this.totalHorasText.getText());
        dao.guardar(project);
        cddao.UpdateTable(this.listProjectTable, "select * from proyecto");
        this.UpdateComboboxProject();
        //initCustomComponentsProy();
    }//GEN-LAST:event_saveButtonActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        cddao.InsertTask(this.ProjectsComboBox.getSelectedItem().toString(), this.TaskNameField.getText() , this.TaskHoursField.getText(), this.TaskDescField.getText());
        cddao.UpdateTable(this.listTaskTable,"select t.tareaid, t.tareanombre, p.proyecto, t.descripcion, t.horastrabajo from tarea t, proyecto p where t.proyectoid = p.proyectoid");
        this.UpdateComboboxTask();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void ProjectComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ProjectComboBoxItemStateChanged
        this.UpdateComboboxTask();
    }//GEN-LAST:event_ProjectComboBoxItemStateChanged
    private void UpdateComboboxTask(){
        try
        {
            this.TaskComboBox.removeAllItems();
            String url = "jdbc:mysql://localhost:3306/dbproyectos";
            String usr = "root";
            String password = "";
            //Class.forName("com.mysql.jdbc.Driver");
            //DriverManager.registerDriver(new org.gjt.mm.mysql.Driver());
            Connection con = DriverManager.getConnection (url,usr, password);            
			
			Statement stat = con.createStatement();
			//ResultSet resultado = stat.executeQuery ("SELECT proyecto FROM proyecto"); 
			String query = "SELECT tareanombre FROM tarea where proyectoid = ( select proyectoid from proyecto where proyecto = '"+this.ProjectComboBox.getSelectedItem().toString()+"' )"; 
                        ResultSet resultado = stat.executeQuery (query); 
			while (resultado.next())
			{
                            TaskComboBox.addItem (resultado.getObject("tareanombre"));
                        }

			resultado.close();
			con.close();
        }



		catch (SQLException ex) {

        }
    }
    private void manageUserIdFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageUserIdFieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_manageUserIdFieldActionPerformed

    private void manageSaveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageSaveButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_manageSaveButtonActionPerformed

    private void listProjectTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listProjectTableMouseClicked

        //mi super cambio aca
        int row = this.listProjectTable.getSelectedRow();
        this.NameProjectText.setText(listProjectTable.getModel().getValueAt(row,1).toString());
        this.beginDateProjectText.setText(listProjectTable.getModel().getValueAt(row,2).toString());
        this.endDateProjectText.setText(listProjectTable.getModel().getValueAt(row,3).toString());
        int index = 0;
        if (listUserTable.getModel().getValueAt(row,4).toString().compareTo("ADMIN") == 0) index = 0;
        else index = 1;
        this.manageRolCombobox.setSelectedIndex(index);
        // TODO add your handling code here:
    }//GEN-LAST:event_listProjectTableMouseClicked

    private void userProjectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userProjectButtonActionPerformed
        // TODO add your handling code here:        
        cddao.linkProjects(this.userListComboBox.getSelectedItem().toString(), this.NameProjectText.getText());        
        User newuser=null;
        Session ses = Session.getInstance();
        try{
        newuser = ses.getUserData();        
        cddao.UpdateTable(this.listAdvancesTable, "select * from proyecto where proyectoid in (select proyectoid from usuario_proyecto where usuarioid =" + newuser.getUserId() + ")");
        }
        catch(Exception e){           
        }
    }//GEN-LAST:event_userProjectButtonActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
        int row = this.listAdvancesTable.getSelectedRow();;
        String projectName = listAdvancesTable.getModel().getValueAt(row,1).toString();
        User newuser=null;
        Session ses = Session.getInstance();
        try{
        newuser = ses.getUserData();        
        }
        catch(Exception e){           
        }
        AdvancesProjectDialog advanceDialog = new AdvancesProjectDialog(ProjectForm.this,true,projectName,newuser.getName());
        advanceDialog.setVisible(true);
    }//GEN-LAST:event_jButton2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ProjectForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ProjectForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ProjectForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ProjectForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            
            public void run() {
                
                new ProjectForm().setVisible(true);
                
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextArea AdvanceField;
    private javax.swing.JScrollPane AdvanceScrollPane;
    private javax.swing.JTextField AdvanceTimeField;
    private javax.swing.JScrollPane ListAdvanceScrollPane;
    private javax.swing.JTextField NameProjectText;
    private javax.swing.JButton OkNewPassword;
    private javax.swing.JComboBox ProjectComboBox;
    private javax.swing.JComboBox ProjectsComboBox;
    private javax.swing.JComboBox TaskComboBox;
    private javax.swing.JTextField TaskDescField;
    private javax.swing.JTextField TaskHoursField;
    private javax.swing.JTextField TaskNameField;
    private javax.swing.JComboBox UserRoleText;
    private javax.swing.JTextField beginDateProjectText;
    private javax.swing.JPanel changePasswordPanel;
    private javax.swing.JTextField endDateProjectText;
    private javax.swing.JTextField finishDateText;
    private javax.swing.JTextField idUserText;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTabbedPane jTabbedPane3;
    private javax.swing.JTabbedPane jTabbedPane5;
    private javax.swing.JTable listAdvancesTable;
    private javax.swing.JTable listProjectTable;
    private javax.swing.JTable listTaskTable;
    private javax.swing.JScrollPane listUserScrollPanel;
    private javax.swing.JTable listUserTable;
    private javax.swing.JPanel manageAdavancePanel;
    private javax.swing.JTextField manageEmailField;
    private javax.swing.JTextField manageNameField;
    private javax.swing.JPanel manageProjectPane;
    private javax.swing.JComboBox manageRolCombobox;
    private javax.swing.JButton manageSaveButton;
    private javax.swing.JTextField manageUserField;
    private javax.swing.JTextField manageUserIdField;
    private javax.swing.JPanel manageUserPanel;
    private javax.swing.JPanel myProfileJPanel;
    private javax.swing.JTextField nameProjectText;
    private javax.swing.JTextField nameUserText;
    private javax.swing.JPasswordField newPasswordField;
    private javax.swing.JPasswordField newPasswordVerifyField;
    private javax.swing.JPanel newProjectPane;
    private javax.swing.JTabbedPane newProjectTabbedPane;
    private javax.swing.JPanel newUserPanel;
    private javax.swing.JPasswordField oldPasswordField;
    private javax.swing.JPanel projectPane;
    private javax.swing.JTabbedPane projectTabbedPane;
    private javax.swing.JScrollPane projectsScrollPanel;
    private javax.swing.JLabel requiredFinishDateLabel;
    private javax.swing.JLabel requiredNameLabel;
    private javax.swing.JLabel requiredStartDateLabel;
    private javax.swing.JLabel requiredTotalHoursLabel;
    private javax.swing.JLabel rolUserLabel;
    private javax.swing.JButton saveAdvanceButton;
    private javax.swing.JButton saveButton;
    private javax.swing.JButton saveChangesUserProfileButton;
    private javax.swing.JPanel saveTaskButton;
    private javax.swing.JButton saveUserButton;
    private javax.swing.JTextField startDateText;
    private javax.swing.JLabel stateUserLabel;
    private javax.swing.JPanel taskPane;
    private javax.swing.JTextField totalHorasText;
    private javax.swing.JTextField userEmailText;
    private javax.swing.JTextField userFullNameText;
    private javax.swing.JTabbedPane userIdPanel;
    private javax.swing.JComboBox userListComboBox;
    private javax.swing.JTextField userMailText;
    private javax.swing.JTextField userNameText;
    private javax.swing.JPasswordField userPasswordText;
    private javax.swing.JButton userProjectButton;
    // End of variables declaration//GEN-END:variables
    private javax.swing.JTable proyectosTbl;
    private javax.swing.JScrollPane paneProyect;
}
